<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #ball{
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background-color: red;
            position: absolute;
            top: 0;
            left: 0;
        }
        #move{
            position: absolute;
            top: 30px;

        }
    </style>
    <script src="../jquery.min.js"></script>
</head>
<body>
    <!-- <div>
        <img id="img" src="../img/boy.png" alt="">
    </div>
    <button id="btn">隐藏</button> -->

    <div id="ball"></div>
    <button id="move">右移</button>
</body>
<script>
    $("#btn").on("click",function(){
        if($("#btn").text()=="隐藏"){
            $("#img").fadeOut(2000,function(){
                $("#btn").text("显示");
            })
        }
        else{
            $("#img").fadeIn(2000,function(){
                $("#btn").text("隐藏");
            })
        }
    })

    $("#move").on("click",function(){
        $("#ball").fadeIn(200);
        $("#ball").animate({
            left:"200px",
            top:"100px"
        })
        setTimeout(function(){
            $("#ball").animate({
                top:"10px"
            })
        },201)
        setTimeout(function(){
            $("#ball").fadeOut(200)
        },202)
    })

    $(function(){
        alert("页面加载完成")
    })
    //on("事件名称", "")

</script>
</html>